import {submitFormData, submitJsonData, submitMultipartFormData} from "../../../../../../redare/utils/Request";

/**
 * Created by RdevPlugins.JsPresenterBuilderAction on 2020-03-07 13:02:40.
 */

/**
 * @param body: {menuId, platformMenuId, parentMenuId, enabled, refPage, excRoot, sortToTree, levelTreeQuery, excMenuAndChildrenByMenuId, platform}
 * @param query: {curPage,pageSize}
 * @returns Promise
 */
export function findMenuPage(body, query) {

    return new Promise((resolve, reject) => {

        submitJsonData({
            url: '/api/_webplatform_workbench/menu/page',
            bodyParams: body,
            urlParams: query
        }).then(
            result => {
                resolve(result);
            },
            error => reject(error)
        );
    });
}

/**
 * @param body: {menuId, platformMenuId, parentMenuId, enabled, refPage, excRoot, sortToTree, levelTreeQuery, excMenuAndChildrenByMenuId, platform}
 * @param query: {returnAll,curPage,pageSize}
 * @returns Promise
 */
export function findMenuList(body, query) {

    return new Promise((resolve, reject) => {

        submitJsonData({
            url: '/api/_webplatform_workbench/menu/list',
            bodyParams: body,
            urlParams: query
        }).then(
            result => {
                resolve(result);
            },
            error => reject(error)
        );
    });
}

